import axios from '../AxiosConfig.js'

export const createRole = data => {
  return axios({
    method: 'post',
    url: '/api/manage/role',
    data: data
  })
}

export const deleteRole = ukId => {
  return axios({
    method: 'delete',
    url: '/api/manage/role',
    params: {"ukId": ukId}
  })
}

export const updateRole = data => {
  return axios({
    method: 'put',
    url: '/api/manage/role',
    data: data
  })
}

export const listRole = (name) => {
  return axios({
    method: 'get',
    url: '/api/manage/role/list',
    params: {"name": name}
  })
}

export const listRoleByOrgUkId = (orgUkId) => {
  return axios({
    method: 'get',
    url: '/api/manage/role/list/org',
    params: {"orgUkId": orgUkId}
  })
}

export const bindRoleApi = (roleUkId, apiUkIdList) => {
  return axios({
    method: 'put',
    url: '/api/manage/role/bind/api',
    data: {
        "roleUkId": roleUkId,
        "apiUkIdList": apiUkIdList
    }
  })
}

export const bindRoleView = (roleUkId, viewUkIdList) => {
  return axios({
    method: 'put',
    url: '/api/manage/role/bind/view',
    data: {
        "roleUkId": roleUkId,
        "viewUkIdList": viewUkIdList
    }
  })
}


